﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using EzFrameWork;
public class HightLightCanvasPanel : MonoBehaviour
{
    //定义变量
    private List<InputField> listInputField = new List<InputField>();//用来管理InputFild的容器
    private Button m_ShowBtn;
    private Text m_Text;
    private Button m_DontShowBtn;
    private Text m_mText1;
    public HightLightOutLine outLine;
    bool isShowOutLine = false;
    private void Awake()
    {
        InitFunc();      //获取组件
        AddLisiners();//监听事件
    }

    //初始化函数 用于获取UI组件等
    private void InitFunc()
    {
        m_ShowBtn = ToolUnity.FindGameObject(gameObject, "ShowBtn").GetComponent<Button>();
        m_Text = ToolUnity.FindGameObject(gameObject, "Text").GetComponent<Text>();
        m_DontShowBtn = ToolUnity.FindGameObject(gameObject, "DontShowBtn").GetComponent<Button>();
        m_mText1 = ToolUnity.FindGameObject(gameObject, "m_Text1").GetComponent<Text>();
    }
    //将模型层的数据同步到View层
    private void SetData()
    {
    }
    //初始化函数 用于获取UI组件等
    private void AddLisiners()
    {
        m_ShowBtn.onClick.AddListener(() => {
            Debug.Log("ShowBtn (UnityEngine.GameObject)");
            if (!isShowOutLine)
            {
                outLine.ShowOutLine();//开启高亮Shader
                isShowOutLine = true;
            }
        });
        m_DontShowBtn.onClick.AddListener(() => {
            Debug.Log("DontShowBtn (UnityEngine.GameObject)");
            if (isShowOutLine)
            {
                outLine.CloseOutLine();//关闭高亮shader
                isShowOutLine = false;
            }
        });
        if (listInputField.Count > 0)
        {
            foreach (InputField item in listInputField)
            {
                item.onValueChanged.AddListener(value => { Debug.Log(item.name + ":" + value); });
            }
        }
    }
}
